package com.ecoolex.discount.sales.enums;

import com.ecoolex.discount.sales.entity.DiscountOrder;
import com.ecoolex.framework.common.EnumInterface;
import com.ecoolex.framework.common.util.Check;

public enum DiscountOrderProcessStatus implements EnumInterface<DiscountOrderProcessStatus, Integer> {
	UNKNOWN(0, "未知"),
	PROCESSING(31, "处理中"),
	PROCESS_FAILED(32, "处理失败"),
	PROCESS_SUCCEED(33, "处理成功"),
	;

	private int real;

	private String describe;

	private DiscountOrderProcessStatus(int real, String describe) {
		this.real = real;
		this.describe = describe;
	}

	@Override
	public Integer real() {
		return real;
	}

	@Override
	public String describe() {
		return describe;
	}

	public static DiscountOrderProcessStatus realValueOf(Integer real) {
		if (Check.notNull(real)) {
			for (DiscountOrderProcessStatus v : values()) {
				if (v.real().equals(real)) {
					return v;
				}
			}
		}
		return null;
	}
	
	public static boolean canPartConfirmComplete(DiscountOrder order) {
		return PROCESS_SUCCEED.equal(order.getProcessStatus());
	}
}
